<template>
    <div id="risk-order-content" class="order-content">
        <!-- 指令相关 -->
        <el-row class="risk-order-top">
            <el-col :span="12" class="form-col col-box">
                <div class="col-box-top">
                    <h3 class="title">风控指令:</h3>
                    <el-row class="title-box">
                        <el-col :span="12" style="display: flex">
                            <label for="batchNo" style="width: 175px;text-align: right;padding-right: 10px;line-height: 28px;">批次号:</label>
                            <el-input size="mini" name="batchNo" disabled placeholder="自动生成"></el-input>
                        </el-col>
                        <el-col :span="12" style="display: flex">
                            <label for="instructionType" style="width: 175px;text-align: right;padding-right: 10px;line-height: 28px;"
                                >指令类型:</label
                            >
                            <el-select name="instructionType" v-model="showFormType" size="mini" @change="handleInstTypeChange">
                                <el-option v-for="(value, key) in instructionTypePojo" :key="key" :label="instructionTypePojo[key]" :value="key">
                                </el-option>
                            </el-select>
                        </el-col>
                    </el-row>
                    <!-- 指令表单 -->
                    <el-row class="form-content">
                        <div :key="renderCountKey">
                            <ExchangeForm
                                v-if="showFormType == '1'"
                                key="1"
                                :detail="exchangeForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <PrimaryBondBidForm
                                v-else-if="showFormType == '2'"
                                key="2"
                                :isBatchFund="true"
                                :selectStockInfo="stockInfo"
                                :detail="primaryBondBidForm"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <OfflineSubscribeForm
                                key="3"
                                v-else-if="showFormType == '3'"
                                :selectStockInfo="stockInfo"
                                :isBatchFund="true"
                                :detail="offlineSubscribeForm"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <RefinancingForm
                                key="4"
                                v-else-if="showFormType == '4'"
                                :detail="RefinancingForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                            />
                            <BankBondForm
                                v-else-if="showFormType == '5'"
                                :detail="bankBondForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <BankBuybackForm
                                v-else-if="showFormType == '6'"
                                :detail="bankBuybackForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <DepositForm
                                v-else-if="showFormType == '7'"
                                :detail="depositForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <!-- <DepositForm
                                v-else-if="showFormType == '8'"
                                :detail="depositForm"
                                :noticeDaysStatus="true"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                            /> -->
                            <DepositPaidForm
                                v-else-if="showFormType == '9'"
                                :detail="depositPaidForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <ExchangeBulkForm
                                v-else-if="showFormType == '10'"
                                :detail="exchangeBulkForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <ShFixedForm
                                v-else-if="showFormType == '11'"
                                :detail="shFixedForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <FutureGoodsForm
                                v-else-if="showFormType == '12'"
                                :detail="futureGoodsForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                            <CwOpenFundForm
                                v-else-if="showFormType == '13'"
                                :detail="cwOpenFundForm"
                                :isBatchFund="true"
                                @handleSettingValue="getForm(arguments)"
                                @getStockInfo="getStockInfo"
                            />
                        </div>
                    </el-row>
                </div>

                <div class="select" style="height: calc(40% - 30px)">
                    <div v-if="showFormType === '9'" style="margin-top: 10px">
                        <!-- <div style="height: 40%"> -->
                        <span>已选存单</span>
                        <risk-table key="selectPaid" :msg="withdrawListMsg" @handleBtn="handleSelectWithDraw"></risk-table>
                        <!-- </div> -->
                    </div>
                    <div v-if="showFormType === '6'" style="height: calc(100% - 40px)">
                        <!-- <div style="height: 40%"> -->
                        <div style="display: flex; align-items:center; margin-bottom: 5px">
                            <span>已选质押券：</span>
                            <el-select v-model="pledges" multiple collapse-tags size="mini" style="width:180px; margin-right: 10px">
                                <el-option
                                    v-for="(item, index) in pledgeSelectData"
                                    :key="index"
                                    :label="item.stockCode + item.stockNameSt"
                                    :value="item.stockCode"
                                >
                                </el-option>
                            </el-select>
                            <el-button type="primary" size="mini" style="padding-top: 6px; padding-bottom: 6px" @click="handleAddPledgeList"
                                >添加</el-button
                            >
                        </div>
                        <vxe-table
                            :data="selectedPledgeList"
                            border
                            size="mini"
                            style="width: 100%"
                            height="100%"
                            auto-resize
                            resizable
                            :resizable-config="{ minWidth: '60' }"
                            show-header-overflow
                            header-align="center"
                        >
                            <vxe-column
                                v-for="(item, index) in selectedPledgePositionsListMsg.title"
                                :key="index + item.val"
                                :field="item.val"
                                :title="item.name"
                                :sortable="item.sortable"
                                :column-config="{ isHover: true }"
                                :row-config="{ isHover: true }"
                                :filters="item.filters"
                                :filter-method="filterHandler"
                                show-overflow
                                :min-width="item.minWidth"
                                :width="item.width"
                                :fixed="item.fixed"
                            >
                                <template #filter="{ $panel, column }" v-if="['stockCode', 'stockNameSt'].includes(item.val)">
                                    <div>
                                        <el-input
                                            class="my-input"
                                            type="type"
                                            v-for="(option, index) in column.filters"
                                            :key="index"
                                            v-model="option.data"
                                            @input="$panel.changeOption($event, !!option.data, option)"
                                        />
                                    </div>
                                </template>

                                <template slot-scope="scope">
                                    <el-button
                                        v-if="item.val === 'operate'"
                                        type="primary"
                                        icon="el-icon-close"
                                        @click="handleDelSelect(scope.row)"
                                        size="mini"
                                        class="tableButton"
                                    ></el-button>
                                    <!-- 券面总额 -->
                                    <RiskInputNumber
                                        v-else-if="item.val === 'totalFacePrice'"
                                        :input="scope.row.totalFacePrice"
                                        :field="'totalFacePrice'"
                                        :precision="4"
                                        :maxlength="15"
                                        @getInputNumber="getInputNumber(arguments, scope.row)"
                                    >
                                    </RiskInputNumber>

                                    <!-- 质押比率 -->
                                    <RiskInputNumber
                                        v-else-if="item.val === 'pledgeRatio'"
                                        :input="scope.row.pledgeRatio"
                                        :field="'pledgeRatio'"
                                        :precision="2"
                                        :inputAfter="'%'"
                                        :maxlength="15"
                                        @getInputNumber="getInputNumber(arguments, scope.row)"
                                    >
                                    </RiskInputNumber>

                                    <!-- 质押金额 -->
                                    <RiskInputNumber
                                        v-else-if="item.val === 'balance'"
                                        :input="scope.row.balance"
                                        :field="'balance'"
                                        :disabled="true"
                                        :maxlength="15"
                                        :precision="4"
                                        @getInputNumber="getInputNumber(arguments, scope.row)"
                                    >
                                    </RiskInputNumber>
                                    <span v-else-if="['currentAmount', 'facePrice', 'totalPrice', 'balance'].includes(item.val)" style="float:right">
                                        {{ scope.row[item.val] != undefined ? numberFormat(scope.row[item.val], 2) : '--' }}
                                    </span>

                                    <span v-else-if="item.val === 'endDate'" style="display:block;text-align:center">
                                        {{ dateFormat(scope.row[item.val]) || '--' }}
                                    </span>

                                    <span v-else>{{ scope.row[item.val] || '--' }}</span>
                                </template>
                            </vxe-column>
                        </vxe-table>
                        <!-- <risk-table key="pledge" :msg="selectedPledgePositionsListMsg" @handleBtn="handleSelect"></risk-table> -->
                        <!-- </div> -->
                    </div>
                </div>

                <el-row class="form-operate">
                    <el-col :span="6">
                        <i style="font-size: 25px" class="el-icon-setting iconClass" @click="openEntryGroup"></i>
                    </el-col>
                    <el-col :span="18" style="text-align: right;">
                        <el-select style="width: 150px; margin-right: 10px" clearable v-model="directMode" size="mini">
                            <el-option label="有序从严控制" value="0">有序从严控制</el-option>
                            <el-option label="有序非从严控制" value="1">有序非从严控制</el-option>
                            <el-option label="无序从严控制" value="2">无序从严控制</el-option>
                            <el-option label="无序非从严控制" value="3">无序非从严控制</el-option>
                        </el-select>
                        <el-button @click="handleClickButtonReset">重置</el-button>
                        <el-button type="primary" size="mini" @click="handleTestClick">试算</el-button>
                        <el-button type="primary" size="mini" @click="handlePlaceOrderClick">下单</el-button>
                    </el-col>
                </el-row>
            </el-col>
            <!-- 持仓信息 -->
            <el-col :span="12" class="col-box">
                <div class="col-box-top">
                    <h3 class="title">选择产品:</h3>
                    <el-row style="margin-bottom: 10px">
                        <el-col :span="10" style="display: flex;margin-right: 10px">
                            <span class="label">产品代码:</span>
                            <RiskEntryInput @set-entry-data="getEntryslist" :returnDatas="fundCode" />
                        </el-col>
                        <el-col :span="10" style="display: flex;margin-right: 10px">
                            <span class="label">组合编码:</span>
                            <el-select v-model="fundAccountCode" size="mini" multiple collapse-tags>
                                <el-option
                                    v-for="i in computedFundAccountCodeSelectData"
                                    :key="i.fundAccountCode"
                                    :label="i.fundAccountCode + ' ' + i.fundAccountName"
                                    :value="i.fundAccountCode"
                                >
                                </el-option>
                            </el-select>
                        </el-col>
                        <el-col :span="3">
                            <el-button type="primary" size="mini" @click="handleAddFund">添加</el-button>
                        </el-col>
                    </el-row>
                    <!-- 已选产品表格 -->
                    <risk-table
                        ref="selectTable"
                        style="height: calc(100% - 80px)"
                        :msg="positionsListMsg"
                        @handleBtn="handleDelFund"
                        @handleRow="handleClickRow"
                    ></risk-table>
                </div>

                <div class="select" style="height: 45%">
                    <PositionInfo
                        :type="showFormType"
                        :assetInfo="currentAssetInfo"
                        :fundCode="currentFundCode"
                        :fundAccountCode="currentFundAccode"
                        :selectPosition="showFormType === '6' ? selectedPledgeList : [stockInfo]"
                        @getSelectPosition="getTableSelectStockInfo"
                    />
                </div>

                <!-- <div style="height: 40%" v-if="!['2', '3', '6', '9'].includes(showFormType)">
                    <span>产品持仓信息</span>
                    <risk-table
                        :key="positionTableKey"
                        :msg="fundPositionsListMsg"
                        @getList="queryFundPositionList"
                        @handleFilter="handleFilterFundPosition"
                    ></risk-table>
                </div>

                <div style="height: 40%" v-else-if="showFormType == '2'">
                    <span>可投标债券信息</span>
                    <risk-table
                        :key="positionTableKey"
                        :msg="fundPositionsListMsg"
                        @getList="queryFundPositionList"
                        @handleFilter="handleFilterFundPosition"
                    ></risk-table>
                </div>

                <div style="height: 40%" v-else-if="showFormType == '3'">
                    <span>可申购债券信息</span>
                    <risk-table :msg="purchaseStockListMsg" @getList="queryPurchaseStockList" @handleFilter="handleFilterFundPosition"></risk-table>
                </div>

                <div style="height: 40%" v-else-if="showFormType == '9'">
                    <span>可支取存单</span>
                    <risk-table :msg="withdrawListMsg" @getList="queryWithdrawDepositList" @handleFilter="handleFilterFundPosition"></risk-table>
                </div> -->

                <!-- <el-tabs type="card" v-model="activePane">
                    <el-tab-pane label="产品持仓信息" name="1"> </el-tab-pane>
                </el-tabs> -->
            </el-col>
        </el-row>

        <!-- 试算结果 -->
        <el-row class="risk-order-bottom">
            <h3>
                <el-row class="result-span">
                    <el-col :span="3">
                        <span>风控结果:</span>
                        <status-tag :code="riskResult"></status-tag>
                    </el-col>
                    <el-col :span="6">
                        <span>试算/下单时间: </span>
                        <span style="color: red">{{ calcTime }}</span>
                    </el-col>
                    <el-col :span="5">
                        <span>计算耗时: </span>
                        <span style="color: red">{{ takeTime }}</span>
                    </el-col>
                    <el-col :span="6">
                        <span>条目检查数:</span>
                        <span v-show="riskResultTable.length" style="color: red">{{ riskResultTable.length }}</span>
                    </el-col>
                    <el-col :span="4">
                        <el-button style="float: right" type="primary" size="mini" @click="layoutDialog = true">布局设置</el-button>
                    </el-col>
                </el-row>
            </h3>
            <div style="height: calc(100% - 35px)">
                <vxe-table
                    ref="resultTable"
                    :key="tableKey"
                    :auto-resize="true"
                    :data="riskResultTable"
                    border
                    size="mini"
                    style="width: 100%"
                    height="100%"
                    v-loading="calcLoading"
                    resizable
                    :resizable-config="{ minWidth: '60' }"
                    :sort-config="{ sortMethod: customSortMethod, defaultSort: { field: 'thresholdType', order: 'desc' } }"
                    show-header-overflow
                    header-align="center"
                >
                    <vxe-column
                        v-for="(item, index) in showFieldList"
                        :key="index + item.id"
                        :field="item.id"
                        :title="item.content"
                        :sortable="item.sortable"
                        :column-config="{ isHover: true }"
                        :row-config="{ isHover: true }"
                        :filters="item.filters"
                        :filter-method="item.filterMethod"
                        :filter-render="{ name: 'FilterInput' }"
                        show-overflow
                        min-width="120"
                    >
                        <template
                            #filter="{ $panel, column }"
                            v-if="
                                [
                                    'fundCode',
                                    'fundNameSt',
                                    'assetCode',
                                    'assetName',
                                    'fundAccountCode',
                                    'fundAccountName',
                                    'stockCode',
                                    'stockNameSt',
                                    'entryCode',
                                    'entryName',
                                ].includes(item.id)
                            "
                        >
                            <div>
                                <el-input
                                    class="my-input"
                                    type="type"
                                    v-for="(option, index) in column.filters"
                                    :key="index"
                                    v-model="option.data"
                                    @input="$panel.changeOption($event, !!option.data, option)"
                                />
                            </div>
                        </template>
                        <template slot-scope="scope">
                            <span v-if="item.id === 'entryType'">{{ entryType[scope.row.entryType] }}</span>
                            <span v-else-if="item.id === 'compareType'">{{ compareDirection[scope.row.compareType] }}</span>
                            <status-tag v-else-if="item.id === 'thresholdType'" :code="scope.row.thresholdType" />
                            <branch-tag v-else-if="item.id === 'branchNum'" :data="scope.row" />
                            <span v-else-if="['investableBalance', 'maxTradable', 'maxTradableMerge'].includes(item.id)">
                                <el-popover
                                    v-if="getObjectLength(scope.row[item.id]) && getObjectLength(scope.row[item.id]) > 1"
                                    placement="top"
                                    trigger="hover"
                                >
                                    <div style="padding: 0 10px 10px 0" slot v-for="(value, key, index) in scope.row[item.id]" :key="key">
                                        {{ '阀值' + ++index + getShowName(item.id) + ': ' + scope.row[item.id][getParamName(item.id) + index] }}
                                    </div>
                                    <el-tag slot="reference">{{ getObjectLength(scope.row[item.id]) + '个' + getShowName(item.id) }}</el-tag>
                                </el-popover>
                                <span
                                    v-else-if="getObjectLength(scope.row[item.id])"
                                    v-for="(value, key) in scope.row[item.id]"
                                    :key="key"
                                    style="float: right"
                                    >{{ value }}</span
                                >
                                <span v-else style="float: right"> --</span>
                            </span>
                            <span v-else-if="item.id === 'thresholdValue'" style="float: right">{{
                                scope.row[item.id] != undefined ? numberFormat(scope.row[item.id], scope.row.unit) + unitShow(scope.row.unit) : '--'
                            }}</span>

                            <span v-else-if="item.id === 'calculateValue'" style="float: right">
                                {{
                                    scope.row[item.id] != undefined
                                        ? numberFormat(scope.row[item.id], !scope.row.unit || scope.row.unit == '无' ? 2 : scope.row.unit) +
                                          unitShow(scope.row.unit)
                                        : '--'
                                }}
                            </span>
                            <span v-else>{{ scope.row[item.id] || '--' }}</span>
                        </template>
                    </vxe-column>
                </vxe-table>
            </div>
        </el-row>

        <RiskTableLayout
            title="页面布局"
            :visible.sync="layoutDialog"
            :field-list="tableColumns"
            :selected-field-list="selectedFieldList"
            :fixed-field-list="fixedFieldList"
            table-name="BATCH_TRIAL"
            @on-submit="onSubmit"
        />

        <EntryGroupSetting
            v-if="transDialog"
            :resourceCode="resourceCode"
            :transDialog="transDialog"
            @getEntryGroup="getEntryGroup"
            @closeEntryDialog="closeEntryDialog"
        />
        <!--处理下单后的弹窗-->
        <RiskOrderResultAfter
            v-if="orderCancelShow"
            :key="riskOrderResultAfterKey"
            :riskResultThresholdType="result"
            :res="riskOrderResultTable"
            @riskResultContinue="riskResultContinue"
            @riskResultCancel="riskResultCancel"
        />
    </div>
</template>
<script lang="ts">
import Invest from '@/common/dict/invest';
import { getActiveMenuCode, getUser } from '@/utils/user-util';
import { Vue, Component, Watch, Prop } from 'vue-property-decorator';
import RiskEntryInput from '@/common/components/risk-entry-input.vue';
import DictionConstUtil, { objToArr, SGU_CACHE } from '@/utils/diction-const-util';
import { dateFormat, getConfigItem, numberFormat, sortBy, unitShow, UUID } from '@/utils/tools';
import ColumnUtil from '../utils/column-util';
import RiskTable from '@/common/components/risk-table.vue';
import RiskTableLayout from '@/common/components/risk-table-layout.vue';
import StatusTag from '@/pages/risk-measure/components/status-tag.vue';
import BranchTag from '@/pages/risk-measure/components/branch-tag.vue';
import EntryGroupSetting from '../components/entry-group-seting.vue';
import RiskInputNumber from '@/pages/risk-measure/components/risk-input-number.vue';
import RiskOrderResultAfter from '@/pages/risk-time/components/risk-order-result-after.vue';
import { cancelCommonOrder, trialCalculate } from '@/common/api/instruction';
import ExchangeForm from '../components/batchOrder/batchFundOrder/exchange-form.vue';
import PrimaryBondBidForm from '../components/batchOrder/batchFundOrder/primary-bond-bid-form.vue';
import OfflineSubscribeForm from '../components/batchOrder/batchFundOrder/offline-subscribe-form.vue';
import BankBondForm from '../components/batchOrder/batchFundOrder/bank-bond-form.vue';
import BankBuybackForm from '../components/batchOrder/batchFundOrder/bank-buyback-form.vue';
import DepositPaidForm from '../components/batchOrder/batchFundOrder/deposit-paid-form.vue';
import DepositForm from '../components/batchOrder/batchFundOrder/deposit-form.vue';
import ExchangeBulkForm from '../components/batchOrder/batchFundOrder/exchange-bulk-form.vue';
import FutureGoodsForm from '../components/batchOrder/batchFundOrder/future-goods-form.vue';
import ShFixedForm from '../components/batchOrder/batchFundOrder/sh-fixed-form.vue';
import CwOpenFundForm from '../components/batchOrder/batchFundOrder/cw-open-fund-form.vue';
import PositionInfo from '../components/batchOrder/position-info.vue';
import RefinancingForm from '../components/batchOrder/batchFundOrder/refinancing-form.vue';
import moment from 'moment';
export interface pages {
    total?: number;
    pageSize?: number;
    currentPage?: number;
}
@Component({
    name: 'BatchFundOrder',
    components: {
        RiskEntryInput,
        RiskTable,
        RiskTableLayout,
        StatusTag,
        BranchTag,
        EntryGroupSetting,
        RiskInputNumber,
        RiskOrderResultAfter,
        ExchangeForm,
        PrimaryBondBidForm,
        OfflineSubscribeForm,
        RefinancingForm,
        BankBondForm,
        BankBuybackForm,
        DepositForm,
        DepositPaidForm,
        ExchangeBulkForm,
        FutureGoodsForm,
        ShFixedForm,
        CwOpenFundForm,
        PositionInfo,
    },
})
export default class BatchFundOrder extends Vue {
    @Prop()
    detail: any;
    ColumnUtil = new ColumnUtil();
    numberFormat = numberFormat;
    dateFormat = dateFormat;
    unitShow = unitShow;
    SHOW_SECURITY = getConfigItem('SHOW_SECURITY');
    // 指令类型
    instructionTypePojo: any = {
        '1': '交易所指令',
        '2': '债券一级投标',
        '3': '网下申购指令',
        '4': '转融通指令',
        '5': '银行间债券指令',
        '6': '银行间回购指令',
        '7': '存款指令',
        // '8': '存款指令-通知存款',
        '9': '存款支取指令',
        '10': '交易所大宗交易指令',
        '11': '上交所固定收益指令',
        '12': '期货指令',
        '13': '场外开放式基金指令',
    };

    // 下单类型转换成后端对应的instructionType
    InstTypePojo = {
        '1': '4',
        '2': '5',
        '3': '9',
        '4': '14',
        '5': '1',
        '6': '2',
        '7': '3',
        '8': '3',
        '9': '3',
        '10': '7',
        '11': '13',
        '12': '6',
        '13': '8',
    };

    instructionType: string = '';
    showFormType: string = '1';

    // 分页
    pages = { currentPage: 1, pageSize: 25 };

    Invest: any = new Invest(); // 指令相关字典类
    entryType = {}; // 风险类型字典
    compareDirection = {}; // 比较方向字典
    fundCodeSelectData: any[] = []; // 产品序号下拉框数据
    fundAccountCodeSelectData: any[] = []; // 组合编码下拉框数据
    opponentCodeSelectData: any[] = []; // 交易对手方下拉数据
    stockCodeSelectData: any[] = []; // 证券代码下拉框数据
    orderDirectionSelectData: any[] = []; // 订单方向下拉框数据

    allStockType: any[] = []; // 所有证券类别数据
    stockTypePojo: any = {};
    orderDirectionPojo: any = {};
    orderDirectionMapping: any = {};
    marketCodePojo: any = {};
    marketCodeMapping: any = {};

    selectLoading: boolean = false; // 下拉框远程搜索时的加载状态

    calcTime: string = ''; // 下单/试算时间
    takeTime: string | number = ''; // 计算耗时
    riskResult: string | number = ''; // 风控结果
    riskResultTable: any[] = []; // 风控结果表数据

    result: string = ''; // 试算结果

    selectedPledgeList: any[] = [];
    // 已选质押券信息相关
    selectedPledgePositionsListMsg = {
        returnData: { data: [], total: 0 },
        dataKey: 'data',
        title: this.ColumnUtil.selectedPledgeColumns,
        height: '100%',
        // 隐藏页码
        hidePage: true,
        localSearch: true,
        checked: { on: false, option: false },
    };

    // 产品持仓信息相关
    fundPositionsListMsg: any = {
        returnData: { data: [], total: 0 },
        dataKey: 'data',
        title: this.ColumnUtil.proPositionColumns,
        height: '100%',
        // 隐藏页码
        hidePage: false,
        checked: { on: false, option: false },
    };

    // 可申购证券信息相关
    purchaseStockListMsg = {
        returnData: { data: [], total: 0 },
        dataKey: 'data',
        title: this.ColumnUtil.UnderNetStockColumns,
        height: '100%',
        // 隐藏页码
        hidePage: false,
        checked: { on: false, option: false },
    };
    selectedPurchaseStock: any = {}; // 勾选的可申购证券

    // 可支取存单信息
    withdrawListMsg: any = {
        returnData: { data: [], total: 0 },
        dataKey: 'data',
        title: this.ColumnUtil.selectPositionsColumns,
        height: '100%',
        // 隐藏页码
        hidePage: true,
        checked: { on: false, option: false },
    };

    layoutDialog: boolean = false; // 布局设置弹框显示

    // 试算结果表格全部字段
    tableColumns = this.ColumnUtil.riskTableColumns;
    // 要显示的表格列
    showFieldList: any[] = [];
    // 已选择字段列表
    selectedFieldList: any[] = [];
    // 固定字段列表
    fixedFieldList: any[] = [
        { content: '产品代码', id: 'fundCode', sortable: true },
        { content: '产品名称', id: 'fundNameSt', sortable: false },
    ];

    iconDom: any = null; // 试算结果表筛选图标dom
    tableKey: number = 0;
    calcLoading: boolean = false;
    entryTypeArr: any[] = []; // 风险类型
    ThresholdTypeArr: any[] = []; // 阈值类型
    stockInfo: any = {};

    // 是否修改
    isUpdate: boolean = false;
    // 是否下单
    isPlaceOrder: boolean = false;
    transDialog: boolean = false;
    fundFilterList: any[] = [];
    stockCodeKey: string = '';
    stockNameKey: string = '';
    resultFilterList: any[] = [];
    calcPrice: number = 0;
    renderCountKey: number = 0;
    orderPrice: string = '';
    innerOrderDirectionData: any[] = [];
    orderDirectionData: any[] = [];
    pageResult: pages = {
        total: 0,
        currentPage: 1,
        pageSize: 10,
    };
    // 筛选后的试算结果
    filterRiskResultTable: any[] = [];
    positionTableKey: number = 0;
    resultSortList: any[] = [];
    riskOrderResultTable: any[] = [];
    orderCancelShow: boolean = false;
    riskOrderResultAfterKey: number = 0;
    directMode: string = '0';
    instruction: any = {
        orderLevel: '0', // 指令优先级
        orderPurpose: '15', // 指令用途
        investType: '1',
        remark: '',
    };
    stockInfoCache: any = {};

    selectEntryGroupCode = {
        calculateEntryGroup: [],
        excludeEntryGroup: [],
    };
    originOuterOrderCode: string = '';
    resourceCode: string = '';

    selectFundDataSource: any[] = []; // 已添加的产品
    fundCode: string = ''; // 产品序号
    fundAccountCode: string[] = []; // 组合编码
    // 产品信息
    fundInfo = {
        fundCode: '',
        fundNameSt: '',
        fundAccountCode: '',
        fundAccountNo: '',
        fundAccountName: '',
        assetCode: '',
        assetName: '',
    };
    // 选中的产品信息相关
    positionsListMsg = {
        returnData: { data: [], total: 0 },
        dataKey: 'data',
        title: this.SHOW_SECURITY
            ? [
                  {
                      name: '操作',
                      type: 'btn',
                      btns: [{ title: '删除', type: 'primary', icon: 'el-icon-close' }],
                      width: 60,
                      fixed: 'left',
                  },
                  { name: '产品代码', val: 'fundCode' },
                  { name: '产品简称', val: 'fundNameSt' },
                  { name: '资产单元编号', val: 'assetCode' },
                  { name: '资产单元名称', val: 'assetName' },
                  { name: '组合序号', val: 'fundAccountNo' },
                  { name: '组合编码', val: 'fundAccountCode' },
                  { name: '组合名称', val: 'fundAccountName' },
              ]
            : [
                  {
                      name: '操作',
                      type: 'btn',
                      btns: [{ title: '删除', type: 'primary', icon: 'el-icon-close' }],
                      width: 60,
                      fixed: 'left',
                  },
                  { name: '产品代码', val: 'fundCode' },
                  { name: '产品简称', val: 'fundNameSt' },
                  { name: '组合序号', val: 'fundAccountNo' },
                  { name: '组合编码', val: 'fundAccountCode' },
                  { name: '组合名称', val: 'fundAccountName' },
              ],

        isCurrent: true,
        height: '100%',
        hidePage: true,
        checked: { on: false, option: false },
    };
    currentAssetInfo: any = {}; // 表格选中行的资产单元信息

    currentFundCode: string = ''; // 表格选中行的产品代码
    currentFundAccode: string = ''; // 表格选中行的组合编码
    instructionCache: any = {};
    tableSelectStock: any = {};
    pledgePOList: any[] = [];

    exchangeForm: any = {}; // 交易所指令表单
    primaryBondBidForm: any = {}; // 一级债指令表单
    offlineSubscribeForm: any = {}; // 网下申购指令表单
    RefinancingForm: any = {}; // 转融通指令表单
    bankBondForm: any = {}; // 银行间债券
    bankBuybackForm: any = {}; // 银行间回购
    depositForm: any = {}; // 存款表单
    depositPaidForm: any = {}; // 存款支取表单
    exchangeBulkForm: any = {}; // 交易所大宗指令表单
    shFixedForm: any = {}; // 上交所固收指令表单
    futureGoodsForm: any = {}; // 期货指令表单
    cwOpenFundForm: any = {}; // 场外基金指令表单
    oldOuterOrderCode: string = '';
    pledgeSelectData: any[] = []; // 可选质押券
    pledges: any[] = []; // 下拉框选中质押券

    // 获取要修改的指令信息
    @Watch('detail', { immediate: true, deep: true })
    async onWatchDetail() {
        if (this.detail && Object.keys(this.detail).length) {
            this.isUpdate = true;
            this.oldOuterOrderCode = this.detail?.outOrderCode;
            // 获取组合编码下拉框数据
            let arr = await SGU_CACHE('FundAccount', '/fundInfo/accounts', []);
            arr.forEach(item => {
                this.fundAccountCodeSelectData[item.fundCode] = item.fundAccounts;
            });
            this.selectFundDataSource = [];
            this.instructionCache = {};
            this.instructionCache.stockCode = this.detail?.stockCode;
            this.instructionCache.reportCode = this.instructionCache.stockCode.split(' ')[0];
            this.instructionCache.businessType = this.detail?.businessType;
            this.instructionCache.orderPrice = this.detail?.instPrice;
            this.instructionCache.orderAmount = this.detail?.instAmount;
            this.instructionCache.orderBalance = this.detail?.instBalance;
            this.instructionCache.investType = this.detail?.investTypeCode;
            this.instructionCache.orderPriceType = this.detail?.priceType;
            this.instructionCache.opponentCode = this.detail?.opponentCode;
            if (this.detail?.orderDirectionCode) {
                this.instructionCache.orderDirection = this.detail?.orderDirectionCode;
            } else if (this.detail?.orderDirection) {
                if (this.orderDirectionMapping[this.detail?.orderDirection]) {
                    this.instructionCache.orderDirection = this.orderDirectionMapping[this.detail?.orderDirection];
                }
            }
            if (this.detail?.marketCode) {
                this.instructionCache.marketCode = this.detail?.marketCode;
            } else if (this.detail?.marketName) {
                if (this.marketCodeMapping[this.detail?.marketName]) {
                    this.instructionCache.marketCode = this.marketCodeMapping[this.detail?.marketName];
                }
            }
            // 投资类型
            if (this.detail?.investType) {
                let investTypeMapping = DictionConstUtil.ReversePojo(this.Invest.investType);
                if (investTypeMapping[this.detail?.investType]) {
                    this.instructionCache.investType = investTypeMapping[this.detail?.investType];
                }
            }
            this.fundCode = this.detail?.fundCode;
            this.fundAccountCode = [this.detail?.fundAccountCode];

            this.handleAddFund();
            let form: any = {};
            switch (this.detail?.businessType) {
                case '1':
                    if (['l', '98'].includes(this.instructionCache.orderDirection)) {
                        // 转融通
                        this.showFormType = '4';
                        this.instructionCache.deadline = String(this.detail?.deadline); // 期限
                        this.instructionCache.rate = this.detail?.rate; // 费率
                        this.RefinancingForm = JSON.parse(JSON.stringify(this.instructionCache));
                    } else {
                        // 交易所业务
                        this.showFormType = '1';
                        this.exchangeForm = JSON.parse(JSON.stringify(this.instructionCache));
                    }
                    break;
                case '2':
                    if (['3', '4'].includes(this.instructionCache.orderDirection)) {
                        // 银行间债券
                        this.showFormType = '5';
                        this.instructionCache.stockFaceBalance = this.detail?.faceTotalBalance;
                        this.instructionCache.firstSettleDate = String(this.detail?.settleDate);
                        this.instructionCache.settlementBalance = this.detail?.settleBalance;
                        this.instructionCache.totalInterest = this.detail?.netBalance;
                        this.instructionCache.clearSpeed = this.detail?.clearSpeed;
                        this.instructionCache.fullPrice = this.detail?.fullPrice;
                        this.bankBondForm = JSON.parse(JSON.stringify(this.instructionCache));
                    } else if (['5', '6'].includes(this.instructionCache.orderDirection)) {
                        // 银行间回购
                        this.showFormType = '6';
                        this.instructionCache.orderBalance = this.detail?.repoBalance;
                        this.instructionCache.repoDay = this.detail?.repoDay;
                        this.instructionCache.factUseMoney = this.detail?.actualDay;
                        this.instructionCache.firstSettleDate = this.detail?.firstSettleDate;
                        this.instructionCache.endSettleDate = this.detail?.secondSettleDate;
                        this.instructionCache.clearSpeed = this.detail?.clearSpeed;
                        this.instructionCache.orderRate = this.detail?.repoRate;
                        this.instructionCache.shouldInterest = this.detail?.tDayInterest;
                        this.instructionCache.expirePayBalance = this.detail?.dueRepoBalance;
                        this.instructionCache.factUseMoney = moment(this.instructionCache.endSettleDate).diff(
                            this.instructionCache.firstSettleDate,
                            'day'
                        );
                        this.bankBuybackForm = JSON.parse(JSON.stringify(this.instructionCache));
                    }
                    break;
                case '4':
                    // 期货
                    this.showFormType = '12';
                    this.futureGoodsForm = JSON.parse(JSON.stringify(this.instructionCache));
                    break;
                case '6':
                    this.showFormType = '1';
                    this.exchangeForm = JSON.parse(JSON.stringify(this.instructionCache));
                    break;
                case 'A':
                    // 开放式基金
                    this.showFormType = '13';
                    this.cwOpenFundForm = JSON.parse(JSON.stringify(this.instructionCache));
                    break;
                case 'B':
                    // 存款业务
                    if (this.instructionCache.orderDirection == 'F') {
                        this.showFormType = '7';
                        this.instructionCache.depositType = this.detail?.depositType;
                        this.instructionCache.bankCode = this.detail?.bankCode;
                        this.instructionCache.noticeDays = this.detail?.noticeDay;
                        this.instructionCache.mutureDate = this.detail?.dueDate;
                        this.instructionCache.drawDate = this.detail?.drawDate; // 暂无返回
                        this.instructionCache.advanceLimitFlag = this.detail?.advanceType; // 提前支取限制
                        this.instructionCache.depositRate = this.detail?.depositRate;
                        this.instructionCache.orderBalance = this.detail?.depositBalance;
                        this.instructionCache.depositStartDate = moment(this.detail?.dueDate)
                            .subtract(this.detail?.depositTerm, 'days')
                            .format('YYYY-MM-DD'); // 起息日
                        this.instructionCache.depositInterest = this.detail?.depositInterest;
                        this.instructionCache.expireBalance = this.detail?.dueBalance.toFixed(2);
                        this.instructionCache.depositLimitTime = this.detail?.depositTerm;
                        // this.instructionCache.mutureType = this.detail?.mutureType; // 暂无返回
                        this.depositForm = JSON.parse(JSON.stringify(this.instructionCache));
                    } else if (this.instructionCache.orderDirection == 'i') {
                        // 存款支取
                        this.showFormType = '9';
                        this.depositForm = JSON.parse(JSON.stringify(this.instructionCache));
                    }
                    break;
                case 'C':
                    // 申购
                    this.showFormType = '3';
                    this.offlineSubscribeForm = JSON.parse(JSON.stringify(this.instructionCache));
                    this.offlineSubscribeForm.orderDirection = 'C';
                    this.offlineSubscribeForm.businClass = this.instructionCache.businessType;
                    this.offlineSubscribeForm.earnestBalance = this.detail?.earnestBalance; // 申购定金
                    console.log(this.instructionCache, 'kkkkkkkkkkkkkkk');

                    break;
                case 'D':
                    // 一级债
                    this.showFormType = '2';
                    this.primaryBondBidForm = JSON.parse(JSON.stringify(this.instructionCache));
                    break;
                case 'E':
                    // 交易所大宗
                    this.showFormType = '10';
                    this.exchangeBulkForm = JSON.parse(JSON.stringify(this.instructionCache));
                    break;
                case 'I':
                    // 上交所固收
                    this.showFormType = '11';
                    this.instructionCache.yield = this.detail?.yield;
                    this.instructionCache.totalInterest = this.detail?.totalInterest;
                    this.instructionCache.fullPrice = this.detail?.fullPrice;
                    this.instructionCache.fullBalance = this.detail?.fullBalance;

                    this.shFixedForm = JSON.parse(JSON.stringify(this.instructionCache));
                    break;
                default:
                    break;
            }
        }
    }

    async mounted() {
        this.resourceCode = getActiveMenuCode().defaultActive;
        this.getUserSelectEntryGroupList();

        // 获取产品信息 (产品序号下拉框数据)
        this.fundCodeSelectData = await SGU_CACHE('FundInfo', '/fundInfo/list', []);
        let arr = await SGU_CACHE('FundAccount', '/fundInfo/accounts', []);
        arr.forEach(item => {
            this.fundAccountCodeSelectData[item.fundCode] = item.fundAccounts;
        });
        // 获取所有证券类别 (用于筛选订单方向)
        this.allStockType = await SGU_CACHE('StockType', '/dict/stockType/list', []);
        // 获取所有订单方向
        this.orderDirectionPojo = DictionConstUtil.ListToPojo(await SGU_CACHE('TradeDirection', '/dict/tradeDirections', []));
        this.orderDirectionMapping = DictionConstUtil.ReversePojo(this.orderDirectionPojo);
        // 获取所有交易市场
        this.marketCodePojo = DictionConstUtil.ListToPojo(await DictionConstUtil.FNMarketType());
        this.marketCodeMapping = DictionConstUtil.ReversePojo(this.marketCodePojo);

        // 获取风险类型字典
        this.entryType = this.Invest.entryType;
        // 获取比较方向字典
        this.compareDirection = this.Invest.CompareDirection;
        this.entryTypeArr = this.objToArr(this.Invest.entryType);
        this.ThresholdTypeArr = this.objToArr(this.Invest.ThresholdType);
        this.queryLayout();
    }

    /* ******************** 指令表单相关start ********************** */

    // 组合编码下拉框计算属性
    get computedFundAccountCodeSelectData() {
        return this.fundAccountCodeSelectData[this.fundCode] || [];
    }

    // 指令事件回调
    getForm(msg: any) {
        this.instructionCache = JSON.parse(JSON.stringify(msg[0]));
    }

    getStockInfo(val: any) {
        this.stockInfo = val;
    }

    // 清空表单
    handleClearForm() {
        this.instructionCache = {};
        this.exchangeForm = {}; // 交易所指令表单
        this.primaryBondBidForm = {}; // 一级债指令表单
        this.offlineSubscribeForm = {}; // 网下申购指令表单
        this.RefinancingForm = {}; // 转融通指令表单
        this.bankBondForm = {}; // 银行间债券
        this.bankBuybackForm = {}; // 银行间回购
        this.depositForm = {}; // 存款表单
        this.depositPaidForm = {}; // 存款支取表单
        this.exchangeBulkForm = {}; // 交易所大宗指令表单
        this.shFixedForm = {}; // 上交所固收指令表单
        this.futureGoodsForm = {}; // 期货指令表单
        this.cwOpenFundForm = {}; // 场外基金指令表单
    }

    // 指令类型变化事件
    handleInstTypeChange(val) {
        this.isUpdate = false;
        this.handleClearForm();
        this.stockInfo = {};
        if (val === '12') {
            this.fundPositionsListMsg.title = this.ColumnUtil.FuturesPositionColumns;
        } else if (!['2', '3', '6', '9'].includes(val)) {
            this.fundPositionsListMsg.title = this.ColumnUtil.proPositionColumns;
        } else if (val == '9') {
            // this.withdrawListMsg.title = this.ColumnUtil.CKPositionsColumns;
        }
        this.positionTableKey++;
    }

    getEntryslist(val) {
        this.fundCode = val;
        this.fundAccountCode = [];
    }

    getInputNumber(args: any, row: any) {
        // debugger;
        let value = args[0];
        let field = args[1];
        row[field] = value;
        if (field === 'totalFacePrice') {
            // 质押数量 = 实时持仓数量
            row['pledgedQty'] = row['currentAmount'];
            // 质押金额 = 券面总额 * 质押比率 / 100
            row['balance'] = (Number(row['totalFacePrice']) * Number(row['pledgeRatio'])) / 100;
        } else if (field === 'pledgeRatio') {
            row['balance'] = (Number(row['totalFacePrice']) * Number(row['pledgeRatio'])) / 100;
        }
        this.pledgePOList = this.selectedPledgeList.map(ele => {
            return {
                // totalFacePrice: String(ele.totalFacePrice || ''),
                totalFacePrice: String(Number(ele.totalFacePrice || '0') * 10000 || ''),
                fundAccountCode: ele.fundAcCode,
                pledgeRatio: ele.pledgeRatio,
                pledgedQty: ele.pledgedQty,
                investType: ele.investType,
                marketCode: ele.marketCode,
                reportCode: ele.stockCode.split(' ')[0] || '',
            };
        });
    }

    /* ******************** 指令表单相关end ********************** */

    /* *********************** 产品持仓start ********************** */

    // 添加产品
    handleAddFund() {
        this.fundInfo.fundCode = this.fundCode;
        // 获取选中的产品信息
        this.fundCodeSelectData.forEach(ele => {
            if (ele.fundCode === this.fundCode) {
                this.fundInfo.fundNameSt = ele.fundNameSt;
            }
        });
        // 获取选中的产品编码信息
        this.fundAccountCodeSelectData[this.fundCode].forEach(ele => {
            this.fundAccountCode.forEach(item => {
                if (ele.fundAccountCode === item) {
                    this.fundInfo.fundAccountCode = item;
                    this.fundInfo.fundAccountNo = ele.fundAccountNo;
                    this.fundInfo.fundAccountName = ele.fundAccountName;
                    this.fundInfo.assetCode = ele.assetCode;
                    this.fundInfo.assetName = ele.assetName;
                }
            });
        });
        for (let i = 0; i < this.fundAccountCode.length; i++) {
            if (
                this.selectFundDataSource.find(item => item.fundCode === this.fundInfo.fundCode && item.fundAccountCode === this.fundAccountCode[i])
            ) {
                continue;
            }
            this.selectFundDataSource.unshift({
                key: this.fundInfo.fundCode + '-' + this.fundAccountCode[i],
                fundCode: this.fundInfo.fundCode,
                fundNameSt: this.fundInfo.fundNameSt,
                fundAccountCode: this.fundAccountCode[i],
                fundAccountName: this.fundInfo.fundAccountName,
                fundAccountNo: this.fundInfo.fundAccountNo,
                assetCode: this.fundInfo.assetCode,
                assetName: this.fundInfo.assetName,
            });
        }
        this.positionsListMsg.returnData.data = this.selectFundDataSource;
        this.positionsListMsg.returnData.total = this.selectFundDataSource.length;
        // 设置默认选中第一条数据
        (this.$refs['selectTable'] as any).$refs['riskTable'].setCurrentRow(this.selectFundDataSource[0]);
        this.handleClickRow({ row: this.selectFundDataSource[0] });
        this.queryPledgeList(this.pages);
        this.pledges = [];
    }

    // 清除已选产品
    handleDelFund(row: any) {
        this.selectFundDataSource = this.selectFundDataSource.filter(item => item.fundAccountNo !== row.row.fundAccountNo);
        this.positionsListMsg.returnData.data = this.selectFundDataSource;
        if (this.selectFundDataSource.length) {
            // 设置默认选中第一条数据
            (this.$refs['selectTable'] as any).$refs['riskTable'].setCurrentRow(this.selectFundDataSource[0]);
            this.handleClickRow({ row: this.selectFundDataSource[0] });
            this.queryPledgeList(this.pages);
        } else {
            this.currentFundCode = '';
            this.currentFundAccode = '';
        }
    }

    // 已选产品表格行点击事件
    handleClickRow({ row }) {
        this.currentFundCode = row.fundCode || '';
        this.currentFundAccode = row.fundAccountCode || '';
        this.currentAssetInfo = {
            assetCode: row.assetCode,
            assetName: row.assetName,
        };
    }

    // 查询可质押债券
    queryPledgeList(pages) {
        let form: any = {};
        form = {
            fundCode: [this.fundCode],
            paging: pages,
        };
        // 获取产品持仓信息
        this.$axios.post('position/stock/pledge', form).then((res: any) => {
            this.pledgeSelectData = res.list;
        });
    }

    // 获取选中证券
    getTableSelectStockInfo(val: any) {
        if (this.showFormType == '2') {
            // 一级债
            val.stockCode = val.bondCode;
        }
        if (this.showFormType === '9' && this.withdrawListMsg.returnData.data.length) {
            this.yh_message_warn('不能勾选多个可支取存单');
            return;
        }
        this.stockInfo = val;
        if (this.showFormType === '6') {
            this.selectedPledgeList.push(val);
            this.pledgePOList = this.selectedPledgeList.map(ele => {
                return {
                    totalFacePrice: String(Number(ele.totalFacePrice || '0') * 10000 || ''),
                    fundAccountCode: ele.fundAcCode,
                    pledgeRatio: ele.pledgeRatio,
                    pledgedQty: ele.pledgedQty,
                    investType: ele.investType,
                    marketCode: ele.marketCode,
                    reportCode: ele.stockCode.split(' ')[0] || '',
                };
            });
        } else if (this.showFormType == '9') {
            this.withdrawListMsg.returnData.data.push(val);
        }
    }

    // 添加质押券
    handleAddPledgeList() {
        let select: any[] = [];
        if (this.pledges && this.pledges.length) {
            this.pledgeSelectData.forEach(ele => {
                let obj1 = {
                    totalFacePrice: ele.totalPrice,
                    pledgeRatio: '100',
                    pledgedQty: ele['currentAmount'],
                    balance: '',
                };
                obj1.balance = String((Number(obj1.totalFacePrice || '0') * Number(obj1.pledgeRatio || '0')) / 100);
                let pledgeObj = { ...ele, ...obj1 };
                this.pledges.forEach(item => {
                    if (item == pledgeObj.stockCode) {
                        select.push(pledgeObj);
                    }
                });
            });

            let exsit: boolean = false;
            for (let index = 0; index < select.length; index++) {
                const element = select[index];
                exsit = this.selectedPledgeList.find(item => item.stockCode == element.stockCode);
                if (exsit) {
                    this.yh_message_warn('请勿重复添加同一笔质押券！');
                    break;
                }
            }
            if (!exsit) {
                this.selectedPledgeList = this.selectedPledgeList.concat(select);
            }
        }
        // this.selectedPledgeList = this.selectedPledgeList.filter(item => item.stockCode !== row.stockCode);
    }

    // 取消选中质押券事件
    handleDelSelect(row: any) {
        this.selectedPledgeList = this.selectedPledgeList.filter(item => item.stockCode !== row.stockCode);
        // this.selectedPledgePositionsListMsg.returnData.data = this.selectedPledgeList;
        this.pledgePOList = this.selectedPledgeList.map(ele => {
            return {
                // totalFacePrice: String(ele.totalFacePrice || ''),
                totalFacePrice: String(Number(ele.totalFacePrice || '0') * 10000 || ''),
                fundAccountCode: ele.fundAcCode,
                pledgeRatio: ele.pledgeRatio,
                pledgedQty: ele.pledgedQty,
                investType: ele.investType,
                marketCode: ele.marketCode,
                reportCode: ele.stockCode.split(' ')[0] || '',
            };
        });
    }

    // 选中可支取存单事件
    handleSelectWithDraw(obj) {
        let data = this.withdrawListMsg.returnData.data;
        data = data.filter(item => item.accountNo !== obj.row.accountNo);
        this.withdrawListMsg.returnData.data = data;
    }

    // 重置按钮点击事件
    handleClickButtonReset() {
        this.isUpdate = false;
        this.showFormType = '1';
        this.handleClearForm();
        this.renderCountKey++;
        this.stockInfo = {};
        this.selectFundDataSource = [];
        this.positionsListMsg.returnData.data = [];
        this.selectedPledgeList = [];
        this.fundCode = '';
        this.fundAccountCode = [];
        this.currentFundCode = '';
        this.currentFundAccode = '';
    }

    /* *********************** 产品持仓end ********************** */

    /* ************************ 表格处理相关start *************************** */

    // 获取对象长度
    getObjectLength(obj: any) {
        if (obj) {
            return Object.keys(obj).length;
        } else {
            return 0;
        }
    }

    // 获取可投余量、最大可交易量名称
    getShowName(name: string) {
        if (name == 'investableBalance') {
            return '可投余量';
        } else if (name == 'maxTradable') {
            return '最大可交易量';
        } else if (name == 'maxTradableMerge') {
            return '最大可交易量(汇总)';
        }
    }

    // 获取字段名
    getParamName(name: string) {
        return name == 'investableBalance' ? 'INVESTABLE_BALANCE_' : name == 'maxTradable' ? 'MAX_TRADABLE_' : 'MAX_TRADABLE_';
    }

    // 转表格筛选下拉框数据
    objToArr(param) {
        let list = [];
        for (let key in param) {
            list.push({ label: param[key], value: key });
        }
        return list;
    }

    customSortMethod({ data, sortList }) {
        const sortItem = sortList[0];
        // 取出第一个排序的列
        const { property, order } = sortItem;
        let YHList = [];
        let NoYHlist = [];
        let list = [];
        let key = /^[a-zA-Z]+$/;
        data.forEach(ele => {
            if (ele.entryCode.match('.*[A-Z]+.*') || ele.entryCode.match('.*[a-z]+.*')) {
                YHList.push(ele);
            } else {
                NoYHlist.push(ele);
            }
        });

        if (order === 'asc' || order === 'desc') {
            if (property === 'entryCode') {
                YHList.sort(this.compare('entryCode'));
                NoYHlist.sort(this.compare('entryCode'));
                list = NoYHlist.concat(YHList);
                if (order === 'desc') {
                    list.reverse();
                }
            } else {
                list = data.slice().sort(sortBy(property, order));
            }
        }
        return list;
    }

    compare(property) {
        return function(a, b) {
            var value1 = a[property];
            var value2 = b[property];
            if (value1.length < 10 && value2.length < 10) {
                var f = '0000000000'; // 10个0
                var aa = f.substring(0, 10 - ('' + value1).length) + value1;
                var bb = f.substring(0, 10 - ('' + value2).length) + value2;
                return aa > bb ? 1 : -1;
            } else {
                return value1 > value2 ? 1 : -1;
            }
        };
    }

    filterThresholdType({ value, row, column }) {
        return row.thresholdType == value;
    }

    filterEntryTypeMethod({ value, row, column }) {
        return row.entryType == value;
    }

    // 表格列筛选数据
    filterHandler({ option, row, column }) {
        const property = column['property'];
        return row[property].includes(option.data);
    }

    formatterCell({ cellValue }) {
        return cellValue || '--';
    }

    changeTable() {
        this.$nextTick(() => {
            let icon = [];
            if (!this.iconDom) {
                this.iconDom = document.querySelectorAll('.vxe-icon--funnel');
                this.iconDom.forEach((ele: any, index) => {
                    if (!['风险类型', '阈值类型'].includes(ele.parentNode.parentNode.children[0].innerHTML)) {
                        icon.push(index);
                    }
                });
                for (let i = 0; i < 8; i++) {
                    icon.forEach(ele => {
                        if (ele === i) {
                            this.iconDom[i].className = 'vxe-filter--btn el-icon-search';
                        }
                    });
                }
            }
        });
    }

    /* ************************** 表格处理相关end ***************************** */

    /* **************************** 布局设置start ***************************** */
    // 获取页面布局信息
    async queryLayout() {
        this.calcLoading = true;
        let resList: any = await new Promise((resolve, reject) => {
            this.$axios('/tableLayout/query/BATCH_TRIAL')
                .then((res: any) => {
                    resolve(res);
                })
                .catch(err => {
                    reject(err);
                });
        });
        if (resList) {
            this.selectedFieldList = JSON.parse(resList);
            this.showFieldList = this.fixedFieldList.concat(this.selectedFieldList);
            this.calcLoading = false;
        } else {
            this.selectedFieldList = this.tableColumns;
            this.showFieldList = this.tableColumns;
            this.calcLoading = false;
        }
        // 设置筛选、排序条件
        this.showFieldList.forEach((ele: any) => {
            if (['fundCode', 'assetCode', 'fundAccountCode', 'stockCode', 'entryCode'].includes(ele.id)) {
                this.$set(ele, 'sortable', true);
            }
            if (
                [
                    'fundCode',
                    'fundNameSt',
                    'assetCode',
                    'assetName',
                    'fundAccountCode',
                    'fundAccountName',
                    'stockCode',
                    'stockNameSt',
                    'entryCode',
                    'entryName',
                ].includes(ele.id)
            ) {
                this.$set(ele, 'filterMethod', this.filterHandler);
                this.$set(ele, 'filters', [{ data: '' }]);
                this.$set(ele, 'search', true);
            }
            if (ele.id == 'entryType') {
                // this.$set(ele, 'filterMethod', this.filterEntryTypeMethod);
                this.$set(ele, 'filters', this.entryTypeArr);
            }
            if (ele.id == 'thresholdType') {
                // this.$set(ele, 'filterMethod', this.filterThresholdType);
                this.$set(ele, 'filters', this.ThresholdTypeArr);
            }

            // 重新渲染表格
            this.changeTable();
            this.tableKey++;
        });
    }

    /**
     * 提交成功后回调
     * @param {Object} 回调数据
     */
    async onSubmit(data) {
        await this.queryLayout();
        this.iconDom = null;
        this.changeTable();
        this.tableKey++;
    }

    /* ************************** 布局设置end *******************************/

    /* ******************** 试算、下单处理start *********************** */
    // 校验提交参数
    verifyInstructionParam() {
        // 表单校验字段
        let verifyParams: any = {};
        if (!this.selectFundDataSource || this.selectFundDataSource.length === 0) {
            this.yh_message_warn('至少添加一个基金投资组合');
            return false;
        }
        if (this.showFormType === '9' && !this.withdrawListMsg.returnData.data.length) {
            this.yh_message_warn('请勾选可支取存单');
            return false;
        }
        if (this.showFormType === '1') {
            if ([1, 4].includes(this.instructionCache.showType)) {
                verifyParams = {
                    stockCode: '证券代码',
                    orderPrice: '指令价格',
                    orderAmount: '指令数量',
                    orderDirection: '委托方向',
                    orderBalance: '指令金额',
                };
            } else if (this.instructionCache.showType == 3) {
                verifyParams = {
                    stockCode: '证券代码',
                    orderDirection: '委托方向',
                };
                if (this.stockInfo.quoteType === '1') {
                    this.instructionCache.orderPrice = this.instructionCache.netPrice;
                    this.instructionCache.orderBalance = this.instructionCache.netMoney;
                    // 是否净价
                    verifyParams.netPrice = '净价价格';
                    verifyParams.orderAmount = '指令数量';
                    verifyParams.netMoney = '指令金额';
                } else {
                    this.instructionCache.orderPrice = this.instructionCache.allPrice;
                    this.instructionCache.orderBalance = this.instructionCache.allMoney;
                    verifyParams.orderPrice = '全价价格';
                    verifyParams.orderAmount = '全价数量';
                    verifyParams.orderBalance = '全价金额';
                }
            } else if (this.instructionCache.showType == 6) {
                verifyParams = {
                    stockCode: '证券代码',
                    orderPrice: '回购利率',
                    orderDirection: '委托方向',
                    orderBalance: '指令金额',
                };
            }
            if (this.instructionCache.orderPriceType == '2') {
                delete verifyParams.orderPrice;
            }
        } else if (this.showFormType === '2') {
            verifyParams = {
                stockCode: '证券代码',
                orderPrice: '价格',
                orderBalance: '投标金额',
            };
        } else if (this.showFormType === '3') {
            verifyParams = {
                stockCode: '证券代码',
                orderAmount: '申购数量',
                earnestBalance: '申购定金',
                orderBalance: '申购金额',
                opponentCode: '交易对手',
                orderPrice: '申购价格',
            };
        } else if (this.showFormType === '4') {
            verifyParams = {
                deadline: '期限',
                orderAmount: '融出数量',
                opponentCode: '交易对手',
            };
        } else if (this.showFormType === '5') {
            verifyParams = {
                stockCode: '证券代码',
                stockFaceBalance: '券面总额',
                orderDirection: '委托方向',
                firstSettleDate: '结算日期',
                orderPrice: '净价价格',
                settlementBalance: '结算金额',
                fullPrice: '全价价格',
                opponentCode: '交易对手',
            };
        } else if (this.showFormType === '6') {
            verifyParams = {
                // stockCode: '证券代码',
                clearSpeed: '清算速度',
                repoDay: '回购天数',
                firstSettleDate: '首次结算日期',
                factUseMoney: '实际占款天数',
                endSettleDate: '到期结算日期',
                shouldInterest: '应计利息',
                orderRate: '回购利率',
                expirePayBalance: '到期购回金额',
                orderBalance: '回购金额',
                opponentCode: '交易对手',
            };
        } else if (this.showFormType === '7') {
            verifyParams = {
                depositStartDate: '起息日',
                depositType: '存款类型',
                // depositLimitTime: '存款期限',
                bankCode: '银行总行',
                // mutureDate: '到期日期',
                advanceLimitFlag: '提前支取限制',
                // depositInterest: '存款利息',
                depositRate: '存款利率',
                expireBalance: '到期金额',
                orderBalance: '存款金额',
            };
            let date = this.instructionCache.depositType == '2' ? this.instructionCache.drawDate : this.instructionCache.mutureDate;
            if (this.instructionCache.depositStartDate && date) {
                let beginDate = new Date(this.instructionCache.depositStartDate.replace(/^(\d{4})(\d{2})(\d{2})$/, '$1/$2/$3'));
                let endDate = new Date(date.replace(/^(\d{4})(\d{2})(\d{2})$/, '$1/$2/$3'));
                if (beginDate > endDate) {
                    this.yh_message_warn('起息日期不能大于' + (this.instructionCache.depositType == '2' ? '支取日期' : '到期日期'));
                    return false;
                }
            }
            if (this.instructionCache.depositType == '2') {
                if (this.instructionCache.advanceType == '2') {
                    verifyParams.drawDate = '支取日期';
                }
            } else {
                if (this.instructionCache.mutureType == '1') {
                    verifyParams.depositLimitTime = '存款期限';
                } else {
                    verifyParams.mutureDate = '到期日期';
                }
            }
        } else if (this.showFormType === '9') {
            verifyParams = {
                drawDate: '支取日期',
            };
        } else if (this.showFormType === '10') {
            verifyParams = {
                stockCode: '证券代码',
                orderPrice: '净价价格',
                orderAmount: '指令数量',
                orderDirection: '委托方向',
                orderBalance: '净价金额',
                opponentCode: '交易对手',
            };
        } else if (this.showFormType === '11') {
            verifyParams = {
                stockCode: '证券代码',
                orderAmount: '指令数量',
                orderBalance: '净价金额',
                orderDirection: '委托方向',
                yield: '到期收益率',
                orderPrice: '净价价格',
                opponentCode: '交易对手',
                // fullPrice: '全价价格',
            };
        } else if (this.showFormType === '12') {
            verifyParams = {
                stockCode: '证券代码',
                orderPrice: '指令价格',
                orderDirection: '委托方向',
                orderAmount: '指令数量',
                // orderBalance: '合约价值',
                investType: '投资类型',
            };
        } else if (this.showFormType === '13') {
            verifyParams = {
                stockCode: '证券代码',
                orderAmount: '指令数量',
                orderDirection: '委托方向',
                orderBalance: '指令金额',
            };
            if (this.instructionCache.orderDirection === 'D' || this.instructionCache.orderDirection === 'p') {
                delete verifyParams.orderAmount;
            } else if (this.instructionCache.orderDirection === 'q') {
                delete verifyParams.orderBalance;
            }
        }

        for (let key in verifyParams) {
            if (!this.instructionCache[key] && key !== 'orderPriceType') {
                this.yh_message_warn(verifyParams[key] + ' 不可为空');
                return false;
            }
        }
        return true;
    }

    // 补零
    fillZero(n) {
        let result = n.toString().length === 1 ? '0' + n : n;
        return result;
    }

    // 时间戳转换 yyyy-MM-dd
    formatTime(t = new Date()) {
        let d = new Date(t);
        let year = d.getFullYear();
        let month = d.getMonth() + 1;
        let date = d.getDate();
        let hours = d.getHours();
        let minutes = d.getMinutes();
        let seconds = d.getSeconds();
        let result = `${year}-${this.fillZero(month)}-${this.fillZero(date)} ${this.fillZero(hours)}:${this.fillZero(minutes)}:${this.fillZero(
            seconds
        )}`;
        return result;
    }

    // 批量指令组装
    createBatchInstruction(collective, factInstruction, orderType) {
        let requestId = 'reb' + UUID() + '-' + new Date().getTime();
        let instructionPojo = {
            batchType: '1',
            requestId: requestId,
            instructionType: this.InstTypePojo[this.showFormType],
            orderType: orderType,
            multiType: '1',
            outOrderBatchCode: UUID() + '-' + new Date().getTime(),
            tradeUser: getUser().userCode,
            instList: [],
            cancelType: factInstruction.cancelType,
            directMode: '',
            calculateEntryGroup: this.selectEntryGroupCode.calculateEntryGroup,
            excludeEntryGroup: this.selectEntryGroupCode.excludeEntryGroup,
        };
        if (orderType === '1') {
            instructionPojo.directMode = this.directMode;
        }
        if (this.showFormType == '12') {
            collective.investType = 'b'; // 投资类型
        } else {
            collective.investType = '1'; // 投资类型
        }
        let selectFundDataSource = this.selectFundDataSource;
        let instList = [];
        if (this.showFormType == '1') {
            if (factInstruction.orderPriceType == '2') {
                // factInstruction.orderPrice =
            }
        } else if (this.showFormType == '6') {
            // 银行间回购
            factInstruction.interest = factInstruction.shouldInterest;
            factInstruction.pledgePOList = this.pledgePOList;
        } else if (this.showFormType === '5') {
            // 银行间债券
            let amount = Number(factInstruction.stockFaceBalance) / Number(this.stockInfo?.facePrice);
            factInstruction.orderAmount = (amount === Infinity ? 0 : amount) || this.instructionCache.orderAmount;
        } else if (this.showFormType == '2') {
            factInstruction.orderUser = getUser().userCode;
        } else if (this.showFormType === '9') {
            factInstruction.reportCode = this.stockInfo.reportCode;
            factInstruction.receiptNo = this.stockInfo.receiptNo; // 存单号
            factInstruction.depositRate = this.stockInfo.rate;
            factInstruction.depositStartDate = this.stockInfo.beginDate;
            factInstruction.mutureDate = this.stockInfo.endDate;
            factInstruction.drawInterest = this.stockInfo.receivableInterest;
            factInstruction.orderBalance = this.stockInfo.balance;
            factInstruction.expireBalance = Number(this.stockInfo.receivableInterest) + Number(this.stockInfo.balance);
            factInstruction.bankCode = this.stockInfo.bankNo;
            factInstruction.advanceLimitFlag = this.stockInfo.advanceLimitFlag;
            factInstruction.receivableInterest = this.stockInfo.receivableInterest; //
            factInstruction.balance = this.stockInfo.balance;
            factInstruction.confirmNo = this.stockInfo.confirmNo;
            factInstruction.depositType = this.stockInfo.depositType;
            factInstruction.drawInterest = this.stockInfo.receivableInterest;
            factInstruction.depositStartDate = this.stockInfo.beginDate;
        } else if (this.showFormType == '10') {
            // factInstruction.opponentCode =
        }
        for (let i = 0; i < selectFundDataSource.length; i++) {
            let ele = selectFundDataSource[i];
            instList.push(
                JSON.stringify({
                    orderType: orderType,
                    requestId: requestId,
                    instructionType: this.InstTypePojo[this.showFormType],
                    outerOrderCode: 'eb' + UUID() + String(i) + '-' + new Date().getTime(),
                    remark: collective.remark,
                    ...factInstruction,
                    ...this.instruction,
                    fundCode: ele.fundCode,
                    fundAccountCode: ele.fundAccountCode,
                })
            );
        }
        instructionPojo.instList = instList;
        return instructionPojo;
    }

    // 提交事件
    async handleSubmit(orderType: string) {
        const isUpdate = this.isUpdate;
        // 校验参数规则
        if (!this.verifyInstructionParam()) {
            return;
        }
        // 计算耗时
        let start = window.performance.now();
        if (orderType == '2') {
            this.instructionCache.cancelType = '1';
        } else {
            this.instructionCache.cancelType = '3';
        }
        let instruction = this.createBatchInstruction(this.instruction, this.instructionCache, orderType);
        // 获取当前提交时间 (试算/下单时间)
        this.calcTime = this.formatTime(new Date());
        const resList: any = await new Promise((resolve, reject) => {
            this.$axios
                .post('/dataEngine/order/multiOrder', instruction)
                .then((res: any) => {
                    resolve(res);
                })
                .catch(err => {
                    this.calcLoading = false;
                    reject(err);
                });
        });

        if (resList) {
            // 风控结果
            this.riskResult = resList.thresholdType;
            this.result = resList.thresholdType;
            // 计算耗时
            let end = window.performance.now();
            this.takeTime = ((end - start) / 1000).toFixed(3) + '秒';

            let data = resList.resultList || [];
            // 根据产品代码 匹配产品名称
            data.forEach(ele => {
                ele.requestId = resList.requestId;
                for (let i = 0; i < this.fundCodeSelectData.length; i++) {
                    const item = this.fundCodeSelectData[i];
                    if (ele.fundCode == item.fundCode) {
                        ele.fundNameSt = item.fundNameSt;
                    }
                }

                ele.stockNameSt = this.stockInfo.stockNameSt;
            });

            this.riskOrderResultTable = JSON.parse(JSON.stringify(data));
            // data = data.filter((item) => item.thresholdType != '4');
            // data = data.sort(this.sortBy('thresholdType'));

            // this.riskResult = data[0]?.thresholdType || resList.thresholdType;
            // this.result = data[0]?.thresholdType || resList.thresholdType;
            // 如果结果是合规或者是试算就填充数据，否则等待用户选择完之后填充数据
            if (this.result == '0' || !this.isPlaceOrder) {
                this.resultFilterList = [];
                // this.pageChangeResult(1);
                this.riskResultTable = data;
                this.calcLoading = false;
            }
            if (!this.isPlaceOrder) {
                this.orderCancelShow = false;
                this.yh_message_success('提交试算信息成功');
            } else if (orderType == '2') {
                if (this.result == '0') {
                    this.orderCancelShow = false;
                    this.handleClickButtonReset();
                    this.handleResetResult();
                    const h = this.$createElement;
                    this.$message.success({
                        message: h('p', null, [
                            h('span', null, '本次风控下单结果为'),
                            h('span', { style: 'color: #70b603' }, '"合规"'),
                            h('span', null, '，已下单成功'),
                        ]),
                        showClose: true,
                        customClass: 'messageStyle',
                    });
                } else {
                    console.log('下单触发非合规');
                    this.riskOrderResultAfterKey++;
                    this.orderCancelShow = true;
                }
                if (isUpdate) {
                    this.handleUpdateCancel();
                }
            }
        } else {
            this.handleResetResult();
        }
    }

    // 修改指令撤单
    handleUpdateCancel() {
        cancelCommonOrder({
            cancelOrderType: '2',
            tradeUser: getUser().userCode, // 当前用户
            tradeUserName: getUser().userName, // 当前用户
            orderType: '4',
            instructionType: '10',
            instNo: '',
            originOuterOrderCode: this.oldOuterOrderCode,
            outerOrderCode: UUID() + '-' + new Date().getTime(),
            requestId: UUID() + '-' + new Date().getTime(),
            delOriginOuterOrderCodeList: [this.oldOuterOrderCode],
        })
            .then(res => {})
            .catch(err => {
                this.yh_message_success(err);
            });
    }

    // 清空试算结果
    handleResetResult() {
        this.riskResultTable = [];
        this.riskResult = '';
        this.calcTime = '';
        this.takeTime = '';
    }

    // 试算按钮点击
    handleTestClick() {
        this.isPlaceOrder = false;
        this.orderCancelShow = false;
        this.handleSubmit('1');
    }

    // 下单按钮点击
    handlePlaceOrderClick() {
        this.result = '';
        this.isPlaceOrder = true;
        this.handleSubmit('2');
    }

    // 处理选择结果返回
    riskResultContinue() {
        console.log('继续下达');
        this.calcLoading = false;
        this.handleClickButtonReset();
        this.handleResetResult();
        // this.riskResultTable = this.riskOrderResultTable;
        this.yh_message_success('指令下达成功');
        this.isUpdate = false;
    }

    // 取消
    riskResultCancel() {
        this.calcLoading = false;
        // this.riskResultTable = [];
        console.log('终止下达');
        cancelCommonOrder({
            cancelOrderType: '2',
            tradeUser: getUser().userCode, // 当前用户
            tradeUserName: getUser().userName, // 当前用户
            orderType: '4',
            instructionType: '10',
            instNo: '',
            originOuterOrderCode: this.originOuterOrderCode,
            outerOrderCode: UUID() + '-' + new Date().getTime(),
            requestId: UUID() + '-' + new Date().getTime(),
            delOriginOuterOrderCodeList: [this.originOuterOrderCode],
        }).then(res => {
            this.yh_message_success('已终止指令下达');
        });
    }

    /* ******************************** 试算、下单处理end *************************** */

    /* ************************************ 条目组设置start ********************************** */
    openEntryGroup() {
        this.transDialog = true;
    }

    getEntryGroup(value: any) {
        this.selectEntryGroupCode.calculateEntryGroup = value.calculateEntryGroup;
        this.selectEntryGroupCode.excludeEntryGroup = value.excludeEntryGroup;
    }

    closeEntryDialog() {
        this.transDialog = false;
        this.getUserSelectEntryGroupList();
    }

    getUserSelectEntryGroupList() {
        this.$axios.get('/entry/group/user/select/list/' + this.resourceCode).then((res: any) => {
            res = res || [];
            let selectEntryGroupCode = {
                calculateEntryGroup: res.filter(item => item.instGroupType === '1' && item.groupCode !== 'DEFAULT').map(item => item.groupCode),
                excludeEntryGroup: res.filter(item => item.instGroupType === '2' && item.groupCode !== 'DEFAULT').map(item => item.groupCode),
            };
            this.selectEntryGroupCode.calculateEntryGroup = selectEntryGroupCode.calculateEntryGroup;
            this.selectEntryGroupCode.excludeEntryGroup = selectEntryGroupCode.excludeEntryGroup;
        });
    }

    /* ************************************ 条目组设置end ********************************** */
}
</script>
<style lang="scss" scoped>
@import '@/pages/risk-time/styles/risk-order';
#risk-order-content {
    .risk-order-top {
        height: calc(72vh - 30px);
        .form-col .form-content {
            height: calc(100% - 90px);
        }
        .col-box-top {
            height: 55%;
            // margin-bottom: 10px;
            // border-bottom: 1px solid #d7d7d7;
        }
        .title-box {
            padding-bottom: 5px;
            margin-bottom: 5px;
            border-bottom: 1px solid #d7d7d7;
        }
        .label {
            width: 20vh;
            max-width: 73px;
            text-align: right;
            padding-right: 10px;
            line-height: 25px;
        }
        /deep/.el-pagination {
            padding: 10px 0px 10px 0px !important;
        }
        .vxe-table {
            // height: 100%;
            .el-button-group {
                line-height: 28px;
            }
            /deep/.vxe-table--main-wrapper {
                height: 100%;
            }

            /deep/.el-input__inner {
                height: 28px !important;
                line-height: 28px !important;
            }
        }
        tbody {
            .el-button {
                padding: 0;
            }

            .el-button--mini {
                padding: 2px 8px;
            }
        }
        .select {
            /deep/.vxe-table .vxe-table--body-wrapper.body--wrapper {
                min-height: 40px !important;
            }
        }

        /deep/ .el-select__tags {
            flex-wrap: nowrap;
        }
        /deep/ span.el-tag.el-tag--info.el-tag--mini.el-tag--light {
            display: flex;
            align-items: center;
            width: 74%;
            max-width: fit-content;
            padding: 0px;
            margin: 2px 0 2px 2px;
            .el-select__tags-text {
                display: inline-block;
                // max-width: 40px;
                font-size: 12px;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
        /deep/ .el-select {
            // .el-select__input {
            //     margin-left: 1px;
            // }
            .el-tag__close.el-icon-close {
                right: 1px;
            }
        }
    }
    .risk-order-bottom {
        height: 26vh;
    }
}
</style>
<style lang="scss">
.messageStyle {
    background-color: #ecf9e3;
    border-color: #ecf9e3;
    font-size: 18px;
    .el-icon-success {
        color: #67c23a;
    }
}
</style>
